<template>
<div class="particus">
  <div>
  <div class="particu" @click="handleGallery">
    <img :src="banner" />
    <router-link to="/" tag="span" class="iconfont">&#xe66a;</router-link>
  </div>
  <div class="mp-header" v-show="Showhei" @scroll="handScr" :style="opaObj">
    <span class="iconfont mp-ico">&#xe618;</span>
    <h1 class="header-title">故宫</h1>
  </div>
  <div class="particu-title">
   {{name}}
  </div>
  <div class="particu-icon">
    <span class="iconfont">&#xe71e;</span>
    {{gallery.length}}
  </div>
  </div>
  <gall-home v-show="isShow" @hide-gall="handleHide" :gallery="gallery"></gall-home>
</div>
</template>

<script>
import GallHome from '@/components/Gallery.vue'
export default {
  name: 'particulars',
  components: {
    GallHome
  },
  props: {
    name: String,
    banner: String,
    gallery: Array
  },
  data () {
    return {
      isShow: false,
      Showhei: '',
      opaObj: {
        opacity: 0
      }
    }
  },
  methods: {
    handleGallery () {
      this.isShow = true
    },
    handleHide () {
      this.isShow = false
    },
    handScr () {
      this.scroll = document.documentElement.scrollTop || document.body.scrollTop
      let opa = this.scroll / 150
      this.opaObj.opacity = opa
      this.Showhei = true
    }
  },
  mounted () {
    window.addEventListener('scroll', this.handScr)
  }
}
</script>

<style lang="stylus" scoped="scoped">
  .particus
    position relative
    .particu
      width 100%
      img
        width 100%
      span
        font-size 0.7rem
        position absolute
        top 0.2rem
        left 0.2rem
    .mp-header
      position fixed
      width 100%
      top 0px
      left 0px
      display block
      background #00bcd4
      z-index 99
      .mp-ico
        left 0
        top 0
        width .8rem
        height .88rem
        line-height .88rem
        position absolute
        font-size .36rem
        color #fff
        text-align center
      .header-title
        overflow hidden
        margin 0 1rem
        line-height .88rem
        white-space nowrap
        text-overflow ellipsis
        font-size .32rem
        text-align center
        color #fff
    .particu-title
      position absolute
      left 0.1rem
      bottom 0.2rem
      color white
      font-size 0.4rem
      text-shadow 0 1px 2px rgba(0,0,0,0.70)
    .particu-icon
      position absolute
      right 0
      bottom 0.2rem
      color white
      width 1.6rem
      height 0.4rem
      background #000000
      text-align center
      line-height 0.4rem
      border-radius 0.2rem
</style>
